﻿using AutoMapper;
using CustomerService;
using J.Customer.Application.Command.CustomerListCommand;
using J.CustomerGet.Application.Command.CustomerListCommand;
using J.CustomerModel;
using MediatR;
using StatusDto;

namespace J.Customer.Application.CommandHandler.CustomerListCommandHandler
{
    public class CustomerCommandHandler : IRequestHandler<CustomerCommand, List<CustomerList>>
    {
        private readonly ICustomerListService _customerListService;
        public CustomerCommandHandler(ICustomerListService customerListService)
        {
            _customerListService = customerListService;
        }
        public async Task<List<CustomerList>> Handle(CustomerCommand request, CancellationToken cancellationToken)
        {
            return await _customerListService.GetCustomer(request.phone);
        }
    }
}
